<!DOCTYPE html>
<html lang="zh">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" />
<title>荐购遴选</title>
<link rel="icon" href="favicon.ico" type="image/ico">
<meta name="keywords" content="LightYear,光年,后台模板,后台管理系统,光年HTML模板">
<meta name="description" content="LightYear是一个基于Bootstrap v3.3.7的后台管理系统的HTML模板。">
<meta name="author" content="yinqi">
<link href="css/bootstrap.min.css" rel="stylesheet">
<link href="css/materialdesignicons.min.css" rel="stylesheet">
<link href="css/style.min.css" rel="stylesheet">
</head>
  <style>
    .col-lg-12{
      margin: auto;
    top: 17px;
    left: 0;
    bottom: 0;
    right: 0;
    position: absolute;
    }
    table{
   
   table-layout:fixed;/* 只有定义了表格的布局算法为fixed，下面td的定义才能起作用。 */
  }
  td{
   width:100%;
   word-break:keep-all;/* 不换行 */
   white-space:nowrap;/* 不换行 */
   overflow:hidden;/* 内容超出宽度时隐藏超出部分的内容 */
   text-overflow:ellipsis;/* 当对象内文本溢出时显示省略标记(...) ；需与overflow:hidden;一起使用。*/
}
  </style>
<body>
<div class="lyear-layout-web" id="l">
  <div class="lyear-layout-container">
    <main class="lyear-layout-content" >
      <div class="container-fluid">  
        <div class="row">
          <div class="col-lg-12" >
            <div class="card">
              <div class="card-toolbar clearfix">
                <form class="pull-right search-bar" method="get" action="#" role="form" >
                  <div class="input-group">
                    <div class="input-group-btn">
                      <input type="hidden" name="search_field" id="search-field" value="title">
                      <button class="btn btn-default dropdown-toggle" id="search-btn" data-toggle="dropdown" type="button" aria-haspopup="true" aria-expanded="false">
                      标题 <span class="caret"></span>
                      </button>
                      <ul class="dropdown-menu">
                        <li> <a tabindex="-1" href="javascript:void(0)" data-field="title">题名</a> </li>
                      </ul>
                    </div>
                    <input type="text" class="form-control" value="" name="keyword" placeholder="请输入名称" v-model="resourceInfo.title" v-on:keyup="getDate(1)">
                  </div> 
                </form>
                <div class="toolbar-btn-action">
                  <a class="btn btn-primary m-r-5" href="#!" type="botton" @click="getIds()"><i class="mdi mdi-plus"></i>特殊遴选</a>
                  <a class="btn btn-success m-r-5" href="#!" @click="fash()"><i class="el-icon-refresh"></i>刷新列表</a>
                </div>
              </div>
              <div class="card-body">
                <div class="table-responsive" v-loading="loading" element-loading-text="拼命加载中">
                  <table class="table table-bordered">
                    <thead>
                      <tr>
                        <th>
                          <label class="lyear-checkbox checkbox-primary">
                            <input type="checkbox" id="check-all"><span></span>
                          </label>
                        </th>
                        <th>题名</th>
                        <th>(P/E)ISSN</th>
                        <th>(P/E)ISBN</th>
                        <th>套题名</th>
                        <th>载体</th>
                        <th>国别</th>
                        <th>语种</th>
                        <th>出版社</th>
                        <th>荐购单位</th>
                        <th>状态</th>
                      </tr>
                    </thead>
                    <tbody v-for="(l,index) in list">
                      <tr>
                        <td>
                          <label class="lyear-checkbox checkbox-primary">
                            <input type="checkbox" name="ids[]" :value="l.id" class="id"><span></span>
                          </label>
                        </td>
                        <td>{{l.title}}</td>
                        <td>{{l.Pissn}}/{{l.Eissn}}</td>
                        <td>{{l.Pisbn}}/{{l.Eisbn}}</td>
                        <td>{{l.coverName}}</td>
                        <td>{{l.carrierName}}</td>
                        <td>{{l.countryName}}</td>
                        <td>{{l.languageName}}</td>
                        <td>{{l.publisher}}</td>
                        <td>{{l.organName}}</td>
                        <td>
                          <span v-if="l.distributionStatus=='1'">待遴选</span>
                        </td>
                      </tr>                  
                    </tbody>
                  </table>
                </div>
                <nav>
                   <ul class="pagination pagination-circle">
                    <li class="active"><a>{{totals}}</a></li>
                    <li>
                      <a type="button" @click="getDate(prePage)">
                        <span><i class="mdi mdi-chevron-left" ></i></span>
                      </a>
                    </li>
                    <li ><a>{{page}}</a></li>
                    <li>
                      <a type="button" @click="getDate(nextPage)">
                        <span><i class="mdi mdi-chevron-right"></i></span>
                      </a>
                    </li>
                  </ul> 
                </nav>
              </div>
            </div>
          </div>
          
        </div>
        
      </div>
      
    </main>
    <!--End 页面主要内容-->
  </div>
</div>

<script type="text/javascript" src="js/jquery.min.js"></script>
<script type="text/javascript" src="js/bootstrap.min.js"></script>
<script type="text/javascript" src="js/perfect-scrollbar.min.js"></script>
<!-- <script type="text/javascript" src="js/main.min.js"></script> -->
<script src="https://cdn.bootcss.com/vue/2.6.9/vue.min.js"></script>
<script src="https://cdn.bootcss.com/axios/0.19.0/axios.min.js"></script>
<!-- 引入样式 -->
<link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css">
<!-- 引入组件库 -->
<script src="https://unpkg.com/element-ui/lib/index.js"></script>
<script type="text/javascript">
$(function(){
    $('.search-bar .dropdown-menu a').click(function() {
        var field = $(this).data('field') || '';
        $('#search-field').val(field);
        $('#search-btn').html($(this).text() + ' <span class="caret"></span>');
    });
});
new Vue({
    el:"#l",
    data:{
      list:[],
      size:5, 
      page:1,
      totals:0,
      prePage:1,
      nextPage:1,
      totalPage:1, //总页数
      resourceInfo:{},
      ids:[],
      loading: false,
    },
    created () {
      this.getDate(1);
    },
    methods: {
        getDate(page){
          this.loading = true;
        setTimeout(() => {
        this.loading = false;

          axios.post("http://29n01o8660.oicp.vip/linxuan/listdlx/"+page+"/"+this.size,this.resourceInfo).then(m=>{
            console.log(m)
              this.list=m.data.rows;
              this.totals = m.data.total;
              this.page=page;
              this.totalPage =Math.ceil(this.totals/this.size);
              this.prePage = page>1?page-1:page;
              this.nextPage = page<this.totalPage?page+1:page;
          })
        }, 2000);
        },
        getIds(){
            //获取所选的id
            var ids =[];//定义一个数组
 
            $('input[type="checkbox"]:checked').each(function(){
                ids.push($(this).val());
            }); 
            alert(ids)
            axios.get("http://29n01o8660.oicp.vip/linxuan/dselect/"+ids+"/1").then(m=>{
              console.log(m.data)
              location.reload();
              
          })
        },
        fash(){
          this.getDate(1);
        }
    },
})
</script>
</body>
</html>